From b83e939819b112c290b7e9fd318fe8a20f156b46 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 7 Aug 2014 08:26:38 -0700 Subject: [PATCH] Fix --extern for doc tests for the local crate. Closes #340 --- src/cargo/ops/cargo_rustc/fingerprint.rs | 2 +- tests/test_cargo_compile_git_deps.rs | 3 --- tests/test_cargo_test.rs | 26 +++++++++++++++++++----- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index 0626ec068..323150f01 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -82,7 +82,7 @@ pub fn prepare_target(cx: &mut Context, pkg: &Package, target: &Target, cx.compilation.tests.push(dst.clone()); } else if target.is_bin() { cx.compilation.binaries.push(dst.clone()); - } else if target.is_lib() && target.get_profile().is_compile() { + } else if target.is_lib() { let pkgid = pkg.get_package_id().clone(); cx.compilation.libraries.find_or_insert(pkgid, Vec::new()) .push(root.join(filename)); diff --git a/tests/test_cargo_compile_git_deps.rs b/tests/test_cargo_compile_git_deps.rs index d15977dce..fc391bc9a 100644 --- a/tests/test_cargo_compile_git_deps.rs +++ b/tests/test_cargo_compile_git_deps.rs @@ -714,9 +714,6 @@ test!(dep_with_submodule { pub fn foo() { dep1::dep() } "); - let root = project.url(); - let git_root = git_project.url(); - assert_that(project.cargo_process("cargo-build"), execs().with_stderr("").with_status(0)); }) diff --git a/tests/test_cargo_test.rs b/tests/test_cargo_test.rs index b14043162..f1a1c68c2 100644 --- a/tests/test_cargo_test.rs +++ b/tests/test_cargo_test.rs @@ -498,13 +498,15 @@ test!(lib_with_standard_name { name = "syntax" version = "0.0.1" authors = [] - - [[lib]] - name = "syntax" - test = false "#) .file("src/lib.rs", " + /// ``` + /// syntax::foo(); + /// ``` pub fn foo() {} + + #[test] + fn foo_test() {} ") .file("tests/test.rs", " extern crate syntax; @@ -517,15 +519,29 @@ test!(lib_with_standard_name { execs().with_status(0) .with_stdout(format!("\ {compiling} syntax v0.0.1 ({dir}) +{running} target[..]test[..]syntax-[..] + +running 1 test +test foo_test ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured\n\n\ + {running} target[..]test[..]test-[..] running 1 test test test ... ok +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured\n\n\ + +{doctest} syntax + +running 1 test +test foo_0 ... ok + test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured\n\n\ ", compiling = COMPILING, running = RUNNING, - dir = p.url()).as_slice())); + doctest = DOCTEST, dir = p.url()).as_slice())); }) test!(lib_with_standard_name2 { -- 2.30.2